import './add.scss'
import { Steps,Button } from 'antd';
import React from 'react'

import ProductInfo from './component/info/info.js'
import ProductSale from './component/sale/sale.js'
import ProductAttr from './component/attr/attr.js'
import ProductAsso from './component/asso/asso.js'


const { Step } = Steps;


let productData = {
				  "albumPics": "string",	//画册图片
				  "brandId": 0,				//品牌id
				  "brandName": "string",	//品牌名称
				  "deleteStatus": 0,		//删除状态
				  "description": "string",	//商品描述
				  "detailDesc": "string",	//详情描述
				  "detailHtml": "string",	//电脑端详情
				  "detailMobileHtml": "string",//移动端详情
				  "detailTitle": "string",	//详情标题
				  "feightTemplateId": 0,	//物流收费模板编号
				  "giftGrowth": 0,			//赠送成长值
				  "giftPoint": 0,			//赠送积分
				  "id": 0,					//编号
				  "keywords": "string",		//商品关机纳兹
				  "lowStock": 0,			//最低库存
				  "memberPriceList": [		//会员价格列表
					{
					  "id": 0,
					  "memberLevelId": 0,
					  "memberLevelName": "string",
					  "memberPrice": 0,
					  "productId": 0
					}
				  ],
				  "name": "string",			//商品名称
				  "newStatus": 0,			//是否新品
				  "note": "string",			//商品备注
				  "originalPrice": 0,		//市场价
				  "pic": "string",			//商品图片
				  "prefrenceAreaProductRelationList": [ //关联优选
					{
					  "id": 0,
					  "prefrenceAreaId": 0,
					  "productId": 0
					}
				  ],
				  "previewStatus": 0,		//预告商品
				  "price": 0,
				  "productAttributeCategoryId": 0,//商品属性分类id
				  "productAttributeValueList": [//商品属性值列表
					{
					  "id": 0,
					  "productAttributeId": 0,
					  "productId": 0,
					  "value": "string"
					}
				  ],
				  "productCategoryId": 0,		//商品分类id
				  "productCategoryName": "string",//商品分类名称
				  "productFullReductionList": [ //商品满减
					{
					  "fullPrice": 0,
					  "id": 0,
					  "productId": 0,
					  "reducePrice": 0
					}
				  ],
				  "productLadderList": [//商品阶梯价格设置
					{
					  "count": 0,
					  "discount": 0,
					  "id": 0,
					  "price": 0,
					  "productId": 0
					}
				  ],
				  "productSn": "string", //商品货号
				  "promotionEndTime": "2022-01-09T08:09:17.937Z",//促销结束事件
				  "promotionPerLimit": 0,//促销限制
				  "promotionPrice": 0, //促销价格e
				  "promotionStartTime": "2022-01-09T08:09:17.937Z",//促销开始事件
				  "promotionType": 0, //促销类型
				  "publishStatus": 0,//上下架状态
				  "recommandStatus": 0,//是否推荐
				  "sale": 0,   //销量
				  "serviceIds": "string", //服务保证
				  "skuStockList": [   //商品库存列表
					{
					  "id": 0,
					  "lockStock": 0,
					  "lowStock": 0,
					  "pic": "string",
					  "price": 0,
					  "productId": 0,
					  "promotionPrice": 0,
					  "sale": 0,
					  "skuCode": "string",
					  "spData": "string",
					  "stock": 0
					}
				  ],
				  "sort": 0,   //排序
				  "stock": 0, //库存 
				  "subTitle": "string", //子标题
				  "subjectProductRelationList": [//关联专题
					{
					  "id": 0,
					  "productId": 0,
					  "subjectId": 0
					}
				  ],
				  "unit": "string",   //规格
				  "usePointLimit": 0,  //积分使用限制
				  "verifyStatus": 0,   //审核状态
				  "weight": 0        //重量
				}

export default class extends React.Component{
	
	constructor(props) {
	    super(props);
		this.state={
			current:0,
			steps:[
				{content:<ProductInfo productData={productData} handleStep={this.handleStep}/>},
				{content:<ProductSale productData={productData}  handleStep={this.handleStep}/>},
				{content:<ProductAttr productData={productData}  handleStep={this.handleStep}/>},
				{content:<ProductAsso productData={productData}  handleStep={this.handleStep}/>}
			]
		}
	}
	
	handleStep=(n)=>{
		this.setState({
			current:this.state.current+n
		})
	}

	render(){
		return <div className="form-box">
			<Steps status="process" labelPlacement="vertical"  current={this.state.current}>
				<Step title="填写商品信息"  />
				<Step title="填写商品促销"  />
				<Step title="填写商品属性"  />
				<Step title="选择商品关联"  />
			</Steps>
			<div className="steps-content">
				{this.state.steps[this.state.current].content}
			</div>

			
		
		</div>
	}

}

/*
//基本数据类型，几乎都是值传递
//数值的交换
function f1(a){
	a = 20;
	console.log("里面：",a)
}

let a = 30;
f1(30);   //属于值传递，现金交易
console.log(a);  //a的值是多少

//引用传递
function f2(b){
	b.name="jack";
	console.log("里面的b",b);
}
let b = new Object();
f2(b);
console.log("外面的b",b)
*/